/*
 * Copyright (c) 2024 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import { Expression, SourceFile } from 'ts-morph';

/**
 * Constant resolver interface
 * Responsible for parsing constant values and property values in source files
 */
export interface IConstantResolver {
  /**
   * Resolve constant values
   * @param value Value object to resolve
   * @param sourceFile Source file
   * @param filePath File path
   * @returns Resolved value
   */
  resolveConstant(value: any, sourceFile: SourceFile, filePath: string): any;

  /**
   * Resolve property values
   * @param value Expression node
   * @param sourceFile Source file
   * @param filePath File path
   * @returns Resolved property value
   */
  resolvePropertyValue(value: Expression, sourceFile: SourceFile, filePath: string): any;

  /**
   * Get the path of the variable
   * @param variableName Variable name
   * @param sourceFile Source file
   * @param filePath File path
   * @returns File path of the variable
   */
  getVariableFilePath(variableName: string, sourceFile: SourceFile, filePath: string): string;

  /**
   * Get the path of the variable in another module
   * @param moduleName Module name
   * @param variableName Variable name
   * @param modulePath Module path
   * @returns File path of the variable
   */
  getOtherModuleVariableFilePath(moduleName: string, variableName: string, modulePath: string): string;
}
